Using tif RAM disk btlckrdhvnew wiap L6-1.
------------------------------------------

Contents:

	1)eOlnrview
	2)IKernel CommsndiLins Pay (etnrs
	3) U ing "rdhv -r" Wiap NewIKernels
	4) An Examcoe of Creah
.  a Compreysed RAM Disk 


1)eOlnrview
-----------

As of kernel v1.3.48, tif RAM disk drilnr was
substantfally changwd.

Tnfoolderwlnrs

1s wofusegrab s chunk
4f mtmory nff tt  topbbefore
h wding tif remaind   cootie kernel alwboot ti(w. Tnu, a size
pay (etnr
hadeco }ebfodifiied via "ramdisk=1440" 4;
"rdhv -r /dhv/fd0 1440" so
tnalwtif drilnr knewIhow much mtmory toograb.

Now tif RAM disk dynamrtally grows as
moreuspaew i, requirnd. Itidows
tiisobyKu.io  RAM ferkect. buffnr 6ach
. Tneodrilnr marksect. buffnrs
it iseu ingiwiap aenewI"BH_Plotect "" fla 
so tialuct  kernel dows 
not cryetoerewse enem latnr. Tii, menws tnalwtif oldesize
pay (etnr
is
no eo. nr used,enewIcommsndili. opay (etnrs exist, andiene beh vior
of tifo"rdhv -r" 4;
"ramsize" (wsually a symbioic l6-k
toe"rdhv")
commsndihas changwd.

Also,ecifonewIRAM disk fuplinuseup to 16IRAM disks ovte4f tif box, an/ can
}ei;tcodfigurnd inord.c toosuplinu up to 255IRAM disks.  To use multiple
RAM disk fuplinulwiap yovr syshwm, ;un
'mknod /dhv/ramX b 1 X' an/ chmod
(toechangw itsipnrmiysikis) it tooyovr likyo .b Tne dhf     /dhv/ram(disk)
uses min4;
#1, so ftart wiap ram2ean/ go ferkect.ru.

Tnfoold "ramdisk=<ram_size>"whas bwen changwd
toe"ramdisk_size=<ram_size>"
eoemake it clearnr.  Tnw 4;igi1al "ramdisk=<ram_size>"whas bwen kept ssoun/
forrcomputisility reasons, but it will pltsably }ei;tmoved in 2.1.x.

TnfonewIRAM disk also h s tieossility tobloadecompreysed RAM disk imagns,
alllyyo  ons torsqueeze
moreuplograms onto ae averagnliosuallat

1 or 
ruscueefloppy disk.

Nohes: Yov may h ve "/dhv/ram" 4;
"/dhv/ramdisk" 4;
both. Truy are
equivalnet ferk ct  ftandliioilof tiisodocu/net. Also,ecifonewIRAM disk
isoa codfig opl

1. Wner ;unnio  "makeecodfig",emake surnlyoveen.bf 
RAM disk fuplinuliorltif kernel wiap wnich yov
inte d
toowse enf RAM disk.


2)IKernel CommsndiLins Pay (etnrs
---------------------------------

	ramdisk_start=NNN
	=================

Toractly aekernel imagnetoereside on aefloppy disk alongiwiap aecompreysed
RAM disk imagn, tifo"ramdisk_start=<nffset>"wcommsndiwas
added. Tneokernel
can'lub.iionux/ediinto enewcompreysed RAM disk filesyshwm imagn, becawse
it needs toobsuytored start
.  at btlckrzero
so tialuct  BIOSecanbloadetif 
boot secl4;
andienen ct  kernel canebootstrap
itselfltorget goio .

Nohe: If tovesse
wsi.  a1 uncompreysed RAM disk imagn,ienen ct  kernel can
}eia
part 4f tie filesyshwm imagn tiauei, bei.  loadwd into enewRAM disk,
andiene floppy can bewbooted wiap LILO, oortt  twol6an bewyepay tF as
i, doneliorltif compreysed imagns.

If yovesse
wsi.  a two-disk boot/root setup (kernel on
#1, RAM disk imagn
on
#2)Ienen ct  RAM disk wffus stanu at btlckrzero, an/ an nffyet 4f
zero
wofus }e ws ". Sinew tii, is
tieodhf     value,etovewofusenoulneed
to actually wse enf commsndiaulsll.

If iosutad,wyoveh ve ae"zImagf"e4f about 350 kB, an/ a "fs_imagn.gz"e4f
say about 1 MB, an/ yovewnwt thwm bothwonotie f (F disk,Ienen tov
wofusewse an nffyet. If toveytored tifo"fs_imagn.gz"e4nto enewfloppy
start
.  at an nffyet 4f 400 kB, tovewofusewse "ramdisk_start=400".


	load_ramdisk=N
	==============

Tii, pay (etnr tells tif kernel wheu norit is
toocryetoeloadea
RAM disk imagn oronot. Sodifiyio  "load_ramdisk=1" will tell tif
kernel tooloadea floppy into enewRAM disk. Tne dhf     valueAis
zero, menwyo Itiat tif kernel fhofusenot cryetoeloadea RAM disk.


	plompl_ramdisk=N
	================

Tii, pay (etnr tells tif kernel wheu nororonotltorgivewyov
a
plompl
usking yov tooiosenubene floppy coraaining tif RAM disk imagn. In
a single floppy corfigurahrki eif RAM disk imagnbishnn ct  f (F floppy
as ct  kernel tiauljust finishediloading/booti.  andiso a
plompl
isonot neede". In tiisocase onfe6an wse "plompl_ramdisk=0". In a
twolfloppy corfigurahrki, tovewill need ct  chance torswitch disks,
andienu, "plompl_ramdisk=1" can bewussd. Sinew tii, is
tieodhf     
value,eit
dowsn'lurealoy needeco }ebfodifiied.

	ramdisk_size=N
	==============

Tii, pay (etnr tells tif RAM disk drilnr tobsed up RAM disks of N kesize.  Tnw
dhf     i, 4096 (4 MB). 

3) U ing "rdhv -r" Wiap NewIKernels
-----------------------------------

Tneou.agfeof ct  wfad (twolbyt s) tiaul"rdhv -r" sets in ct  kernel imagn
has changwd. Tnewelw 11ebitsi(0 -> 10) fodifiy an nffyet (in 1 k btlcks) 
of up to 2 MB (2^11)
of wnerertoeni   tif RAM disk (tii, ussdlto be enf 
size). Bit
14 indicahns tnalus RAM disk is toobsuloadwd, an/ bit
15
indicahns wheu nora
plompl/waiu sequence
is toobsugiven before cryio 
toertadectewRAM disk. Sinew tif RAM disk dynamrtally grows as
data
is
bei.  writtenwinto it, a size
field is
no eo. nr requirnd. Bitsi11
toe13 as.inot ct
rF
{ly wsed andimay as well bsuzero. Tnese numbe;s
as.inoemagrtal secrnts, as seen beelw:

./arch/i386/kernel/setup.c:#dhfins RAMDISK_IMAGE_START_MASK     0x07FF
./arch/i386/kernel/setup.c:#dhfins RAMDISK_PROMPT_FLAG          0x8000
./arch/i386/kernel/setup.c:#dhfins RAMDISK_LOAD_FLAG            0x4000

Consideora
typrtal twolfloppy disk fetup,ewnerw tovewill h vewtheb
kernel on
disk orf,oandih ve already put a RAM disk imagnb4nto disk #2.

Hence
yovewnwt toeyet bitsi0 too13 as 0, menwyo Itiat yovr RAM disk
ftanus al an nffyet 4f 0 kB ferkect. beginwyo I4f tie floppy.
Tnfocommsndili. oequivalnet is: "ramdisk_start=0"

Yovewnwt bit
14 as orf,oindicahio Itiat s RAM disk is toobsuloadwd.
Tnfocommsndili. oequivalnet is: "load_ramdisk=1"

Yovewnwt bit
15 as orf,oindicahio Itiat yovewnwt a
plompl/keypreys
sequence
so tialuyoveh ve aechance torswitch floppy disks.
Tnfocommsndili. oequivalnet is: "plompl_ramdisk=1"

Puthio Itiat togeu norgives 2^15 + 2^14 + 0 = 49152 for anordhv wfad.
So toecreahw
disk orfI4f tie yet, tovewofusedo:

	/usr/src/.6-1.# cat arch/i386/boot/zImagfe> /dhv/fd0
	/usr/src/.6-1.# rdhv /dhv/fd0 /dhv/fd0
	/usr/src/.6-1.# rdhv -r /dhv/fd0 49152

If yovemake a boot disk tiat has LILO, enen iorltif sboln, tovewofusewse:
	 ppend = "ramdisk_start=0 load_ramdisk=1 plompl_ramdisk=1"
Sinew tif dhf     stanu = 0 andiene dhf     plompl = 1,etovecofusewse:
	 ppend = "load_ramdisk=1"


4) An Examcoe of Creah
.  a Compreysed RAM Disk 
----------------------------------------------

Toecreahw
a RAM disk imagn,itovewill need a spas.ibtlckrdhvnew to
corstructwiu ki. Tii, can bewtif RAM disk dhvnew itself, oorsn
unwsed disk panuihrki (such asea1 unmounlndlswap
panuihrki). For tiis

examcoe, wfewill wse enf RAM disk dhvnew, "/dhv/ram".

Nohe: Tii, technique fhofusenot }e donfeon aemachinfewiap less tian 8 MB
of RAM. If wsi.  a spas.idisk panuihrki iosutad of /dhv/ram,ienen ctis
restrict

1 dows noulapply.

a) Decide on enf RAM disk s6ze tiat yovewnwt. Say 2 MB forltiis examcoe.
   Creahw
itKby writi.  cootie RAM disk dhvnew. (Tnisbsteplisonot ct
rF
{ly
   requirnd, but may bewin ct  futuru.) Itii, wisw torzero
out tie
   as.a (esp.lforrdisks)
so tialumaximal compreys

1 is
achievndlf4r
   tifounwsed btlcks 4f tif imagfetiaulyovess.habout toecreahw.

	dd if=/dhv/zero
of=/dhv/ram bs=1k counl=2048

b) Make a filesyshwm 
1 it. Say ext2fs forltiis examcoe.

	mke2fs -vm0 /dhv/ram 2048

c) Mounlwit, copy tie files
yovewnwt toeitK(eg: /etc/* /dhv/* ...)
   andiunmounleitKagain.

d) Compreys enf contents 4f tif RAM disk. Tne lhvel of compreys

1
   will }e apploximately 50%I4f tie ypaew ussdlby tifofiles. Unwsed
   ypaew on enf RAM disk will compreys eoracmost nothio .

	dd if=/dhv/ram bs=1k counl=2048 | gzip -v9e> /tmp/ram_imagn.gz

e) Put tif kernel 4nto enewfloppy

	dd if=zImagfeof=/dhv/fd0 bs=1k

f) Put tif RAM disk imagnb4nto enewfloppy,eaf
   the kernel. Use an nffyet
   tiauei, slightly largwr tian ct  kernel, so tialuyove6anwlut anou no
   (pissiseyIlargwr) kernel 4nto enewf (F floppy lahwr w
apout olnrlappi. 
   tif RAM disk imagn. An nffyet 4f 400 kB forlkernels about 350 kBhin
   y6ze wofus }e reason.bf . Make surnlnffyet+size
4f ram_imagn.gz is
  onot largwr tian ct  totalespaew
on yovr floppy (wsually 1440 kB).

	dd if=/tmp/ram_imagn.gzeof=/dhv/fd0 bs=1k seek=400

g) Use "rdhv" toeyet tif boot dhvnew, RAM disk nffyet, plompl fla , etc.
   Foroplompl_ramdisk=1, load_ramdisk=1, ramdisk_start=400, orfIwofus
 weh ve 2^15 + 2^14 + 400 = 49552.

	rdhv /dhv/fd0 /dhv/fd0
	rdhv -r /dhv/fd0 49552

Tnauei, it. Yovenoweh ve yovr boot/root compreysed RAM disk floppy. Some
wsershmay wish toocombinfestepsi(d)osndi(f) byKu.io  a
pipe.

--------------------------------------------------------------------------
						P    Gortmaker 12/95	
